home *** CD-ROM | disk | FTP | other *** search
- #define NAME "testFullPack"
- #define REVISION "2"
-
- /* Programmheader
-
- Name: testFullPack
- Author: SDI
- Distribution: PD
- Description: tests all packmodes with all file-sizes to 100000
- Compileropts: -
- Linkeropts: -l xpkmaster amiga
-
- 1.0 15.05.97 : first version to find IDEA error
- 1.1 16.05.97 : changed output format (shorter)
- 1.2 17.05.97 : fixed a wrong parameter
- */
-
- #include <pragma/exec_lib.h>
- #include <pragma/dos_lib.h>
- #include <pragma/xpkmaster_lib.h>
- #include <exec/memory.h>
- #include "SDI_defines.h"
-
- struct Library *XpkBase = 0;
- ULONG DosVersion = 37;
-
- #define PARAM "METHOD,START/N,PASSWORD,FILE,STEP/N"
-
- void main(void)
- {
- ULONG noth = 1, step = 1;
- struct RDArgs *rda;
- struct args
- {
- STRPTR method;
- ULONG *start;
- STRPTR password;
- STRPTR file;
- ULONG *step;
- } args = {"IDEA", 0, "TestPwd", "testFullPack.out", 0};
-
- args.start = ¬h;
- args.step = &step;
-
- if((rda = ReadArgs(PARAM, (LONG *) &args, 0)))
- {
- if((XpkBase = OpenLibrary(XPKNAME, 0)))
- {
- STRPTR ibuf;
-
- if((ibuf = (STRPTR) AllocMem(100000, MEMF_CLEAR)))
- {
- STRPTR obuf;
-
- if((obuf = (STRPTR) AllocMem(200000, MEMF_ANY)))
- {
- ULONG fh;
-
- if((fh = Open(args.file, MODE_READWRITE)))
- {
- ULONG i, j, olen;
- LONG err;
-
- Seek(fh, 0, OFFSET_END);
-
- for(i = 0; i < 100000; ++i)
- ibuf[i] = i;
-
- for(i = *args.start; !CTRL_C && i <= 100000; i += *args.step)
- {
- Printf("%6ld: ", i);
- FPrintf(fh, "%6ld: ", i);
- for(j = 0; !CTRL_C && j <= 100; ++j)
- {
- if((err = XpkPackTags(XPK_InBuf, ibuf, XPK_InLen, i,
- XPK_PackMethod, args.method, XPK_OutBuf, obuf,
- XPK_OutBufLen, 200000, XPK_GetOutLen, &olen, XPK_Password,
- args.password, XPK_PackMode, j, TAG_DONE)))
- {
- Printf("p%03ld(%02ld), ", j, -err);
- FPrintf(fh,"p%03ld(%02ld), ", j, -err);
- }
- else if((err = XpkUnpackTags(XPK_InBuf, obuf, XPK_InLen, olen,
- XPK_OutName, "NIL:", XPK_Password, args.password, TAG_DONE)))
- {
- Printf("u%03ld(%02ld), ", j, -err);
- FPrintf(fh,"u%03ld(%02ld), ", j, -err);
- }
- }
- if(CTRL_C)
- {
- Printf("\nbreak: %03ld", j);
- FPrintf(fh, "\nbreak: %03ld", j);
- }
- Printf("\n");
- FPrintf(fh, "\n");
- }
- Close(fh);
- }
- FreeMem(obuf, 200000);
- }
- FreeMem(ibuf, 100000);
- }
- CloseLibrary(XpkBase);
- }
- FreeArgs(rda);
- }
- }
-
-